package com.crb.smartcard.core.oma;

import androidx.annotation.NonNull;

import com.crb.smartcard.core.OperationCallBack;
import com.crb.smartcard.core.bean.CardResult;
import com.crb.smartcard.core.bean.InitResult;

public abstract class BaseSmartCard {
    private ReaderType mReaderType;
    final int STATUS_CODE_SUCCESS = 0;
    final int STATUS_CODE_FAIL = -1;

    public abstract void bindService(OperationCallBack<InitResult> callBack);

    public abstract CardResult execute(@NonNull String command);

    public abstract void closeChannel();

    public abstract void closeService();

    CardResult operFail(String errorMsg) {
        closeChannel();
        return new CardResult(STATUS_CODE_FAIL, errorMsg);
    }

    public ReaderType getmReaderType() {
        if (mReaderType == null) {
            return ReaderType.TYPE_SIM;
        }
        return mReaderType;
    }

    public void setmReaderType(ReaderType mReaderType) {
        this.mReaderType = mReaderType;
    }
}
